<template>
  <!-- <el-dialog
    :visible.sync="centerDialogVisible"
    title="工单处理"
    width="1100px"
    destroy-on-close
    @open="open"
  > -->
  <div class="min-h-[700px]" v-loading="isLoading" ref="ruleFormRef">
    <el-tabs v-model="activeName" class="demo-tabs">
      <el-tab-pane label="基本信息" name="1">
        <basicinformation :closedlog="handleClose" :showInfo="formInline?.workerOrderInfo" />
      </el-tab-pane>
      <el-tab-pane label="关联告警" name="2" v-if="formInline.workerOrderInfo?.workOrderType == 3">
        <alarmworkorder :tabdata="formInline?.alarm" />
      </el-tab-pane>
      <el-tab-pane label="巡检工单" name="3" v-if="formInline.workerOrderInfo?.workOrderType == 2">
        <Inspectionworkorder :tabdata="formInline.inspection" />
      </el-tab-pane>
      <el-tab-pane label="工单记录" name="4">
        <workoderrecord :tabdata="formInline.workerOrderRecord" />
      </el-tab-pane>
    </el-tabs>
  </div>
  <!-- </el-dialog> -->
</template>

<script setup lang="ts">
import { ref } from "vue";
import basicinformation from "./components/basic-information.vue";
import alarmworkorder from "./components/alarm-workorder.vue";
import Inspectionworkorder from "./components/Inspection-workorder.vue";
import workoderrecord from "./components/workoder-record.vue";
import { getInfo } from "@/api/operate/work-management/work-management/index";
const centerDialogVisible = ref(false);
const props = defineProps({
  id: {
    type: Number,
    default: 0
  },
  isLoading: {
    type: Boolean,
    default: true
  },
  formInline: {
    type: Object,
    default: {
      workerOrderRecord: [],
      workerOrderInfo: {},
      alarm: [],
      inspection: []
    }
  },
  closedlog: {
    type: Function,
    required: true
  }
});
const showInfo = ref({
  workerOrderRecord: [],
  workerOrderInfo: {},
  alarm: [],
  inspection: []
});
const activeName = ref("1");

const ruleFormRef = ref();
function getRef() {
  return ruleFormRef.value;
}
const closeDialogFn = ref(null);

const closeDialog = (fn?) => {
  fn ? (closeDialogFn.value = fn) : closeDialogFn.value();
};
const handleClose = (e) => {
  if (e == 1) {
    closeDialogFn.value("chexiao");
  } else {
    closeDialogFn.value('');
  }
};
defineExpose({ getRef, closeDialog });
onMounted(() => {
  // setTimeout(() => {
  console.log(props.id, "1111113")
  // }, 2000);
});
</script>
